package com.longjianghuasheng.logistics.business.release_record

import androidx.lifecycle.MutableLiveData
import com.longjianghuasheng.logistics.base.BaseMultiStateViewModel
import com.longjianghuasheng.logistics.data.model.bean.ApiResponseNoData
import com.longjianghuasheng.logistics.entity.ReleaseListResponse
import com.longjianghuasheng.logistics.ext.commit2
import com.longjianghuasheng.logistics.network.apiService

class ReleaseRecordViewModel : BaseMultiStateViewModel() {

    var status = 0

    var keywords = ""

    var id = 0
    val result by lazy {
        MutableLiveData<ReleaseListResponse>()
    }

    val deleteNotify by lazy {
        MutableLiveData<ApiResponseNoData>()
    }

    fun pre_order_list() {
        getData2({ apiService.pre_order_list(page, status, keywords) }, result)
    }

    fun pre_del() {

        commit2({ apiService.pre_del(id) }, deleteNotify)
    }

    val agreeResult by lazy {
        MutableLiveData<ApiResponseNoData>()
    }

    fun agree() {

        commit2({ apiService.agree(id) }, agreeResult)
    }
}